home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Testing & Debugging / Virtual User / Virtual User Current Release / Examples / Example Scripts / AppleLink.vu next >
Encoding:
Text File  |  1998-06-04  |  4.3 KB  |  138 lines  |  [TEXT/MPS ]

  1. #
  2. #    File:            AppleLink.vu
  3. #
  4. #    Contains:        Sample demo working with AppleLink 6.1.  Note that this script
  5. #                    cannot handle the dialogs that appear the first time AppleLink is run.
  6. #                    Make sure that AppleLink has been run at least once and that
  7. #                    the setup dialogs have been properly dismissed so they will not
  8. #                    come up on subsequent executions.
  9. #
  10. #    Written by:        David Gaxiola
  11. #
  12. #    Copyright:        © 1992 by Apple Computer, Inc., all rights reserved.
  13. #
  14. #    Requirements:    AppleLink 6.1 on target machine.
  15. #
  16. #    After Effects:    The file specified by the script parameter savedName is
  17. #                    created in the default folder on the target.
  18. #
  19. #    Change History (most recent first):
  20. #
  21. #        <4+>     12/3/92    RV        
  22. #                 7/1/92        DGG        Created.
  23. #
  24. #    To Do:
  25. #
  26.  
  27. Libraries "Time.vulib","UtilityTasks.vulib","StandardDialogs.vulib","DataUtils.vulib","QuickTasks.vulib";
  28.  
  29. (************************************************************************************
  30. * Task EditAddressBook()
  31. *    This task will perform operations on the AppleLink address book, using the 
  32. *    global gTheAddress as the AppleLink address to enter.  It takes no parameters
  33. *    and returns nothing.
  34. ************************************************************************************)
  35. task EditAddressBook()
  36. begin
  37.     userName := "VU Test Name";
  38.     global gTheAddress;
  39.     
  40.     select [menuItem t:/Edit Addr≈/ m:"Edit"];
  41.     
  42.     CurWindow := match[ window o:1 ]!;
  43.     select [button t:"New Entry" w:[window o:1]];
  44.     WaitForNoMatch( CurWindow );
  45.     
  46.     type k:{userName, tabKey, gTheAddress};
  47.     select [button t:"OK" w:[window t:"Address Book Editor" o:1]];
  48.     
  49.     close [window t:"Address Book Editor" o:1];
  50.     if (match [window s:dialog o:1])
  51.         select [button t:"Save" w:[window o:1]];
  52. end;
  53.  
  54. (************************************************************************************
  55. * Task GenerateSomeText()
  56. *    This task will output a message to the currently active window.
  57. ************************************************************************************)
  58. task GenerateSomeText()
  59. begin
  60.     theCatcher := "and again";
  61.     theListOfStrings := {     
  62.                             "Welcome to Virtual User 2.0!",
  63.                             "We here at Apple are really excited that you chose our product.",
  64.                             "It represents a lot of time spent on research and development of",
  65.                             "the next step in Automated Testing.",
  66.                             "We think you'll find it fun and productive to use,",
  67.                             "and hopefully you'll come back to VU again and again."
  68.                         };
  69.     
  70.     type k:{theCatcher, returnKey};
  71.     UseKeyboardEquivalent("a");
  72.     UseKeyboardEquivalent("x");
  73.     
  74.     for each singleString in theListOfStrings
  75.         type k:{singleString, returnKey};
  76.     for counter := 1 to 5
  77.         UseKeyboardEquivalent("v");
  78. end;
  79.  
  80. (************************************************************************************
  81. * Task SelectSendButton()
  82. *    This task will click on the "send" button in AppleLink 6.1 in the a memo window.
  83. ************************************************************************************)
  84. task SelectSendButton()
  85. begin
  86.     largeScreenX := 468;
  87.     smallScreenX := 400;
  88.     buttonY := 30;
  89.     
  90.     match [screen m:true r:?screenDimensions];
  91.     if (Abs(screenDimensions[1] - screenDimensions[3]) < 640)
  92.         FindObjectInWindow(smallScreenX, 30);
  93.     else
  94.         FindObjectInWindow(largeScreenX, 30);
  95.     click;
  96. end;
  97.  
  98. (************************************************************************************
  99. * script MainApplelink(savedName)
  100. *    This is the main driving part of this script.
  101. ************************************************************************************)
  102. script MainApplelink(savedName := "VU AppleLink Demo")
  103. begin
  104.     # Define variables.
  105.     global  gTheAddress := "TOTALLYFAKEAPPLELINKADDRESS@UNREALNET#";
  106.  
  107.     Launch( 'GEOL', true );
  108.     
  109.     if (not WaitForMatch( [ menuitem t:/AppleLink≈/ ] ))
  110.     begin
  111.         LogError("Failed to launch AppleLink 6.1 application!", false);
  112.         exit;
  113.     end;
  114.     else
  115.     begin
  116.         Select[ menuitem t:/AppleLink≈/ ];
  117.         WaitForMatch( [ application t:/AppleLink≈/ ] );
  118.     end;
  119.  
  120.     # Edit the address book.
  121.     EditAddressBook();
  122.  
  123.     # Create a new memo and enter a message.
  124.     select [menuItem t:"New Memo" m:[menu t:"File" o:2]];
  125.     WaitForMatch( [window t:"Untitled" ] );
  126.     GenerateSomeText();
  127.     
  128.     # Send the memo.
  129.     SelectSendButton();
  130.     type k:{gTheAddress};
  131.     type k:{tabKey, tabKey};
  132.     type k:{"Virtual User Test!"};
  133.     select [button t:"Send" w:[window s:dialog o:1]];
  134.     
  135.     # Save the memo and clean up.
  136.     DoSaveAs(savedName);
  137.     close [window t:savedName];
  138. end;